<template>
  <div class="pubarticle">
    <!-- 面包屑导航 -->
    <BreadcrumbNav title="发布文章"></BreadcrumbNav>
    <!-- 卡片区域 -->
    <el-card>
      <!-- 富文本编辑器区域 -->
      <EditorArea @release="handleSubmit"></EditorArea>
    </el-card>
  </div>
</template>

<script setup>
  import { useStore } from "vuex"
  import BreadcrumbNav from "../../components/breadcrumb-nav/index.vue"
  import EditorArea from "../../components/editor-area/index.vue"
  import { createWeblog } from "../../service/api_weblog"
  // 页面数据
  const store = useStore()
  // 事件处理
  const handleSubmit = (weblogInfo) => {
    createWeblog(weblogInfo).then(res => {
      if (res.status === 200) {
        ElMessage.success("发表文章成功")
        store.commit("weblog/changeWeblogFlagMutation")
      }
    })
  }
</script>

<style scoped>

</style>